<<<<<<< HEAD
import React from "react"
import { observer,inject } from "mobx-react"
@inject('searchStore')
@observer
class Result extends React.Component{
    constructor(){
        super()
        this.state={
            arr:[],
            checked:false
        }
    }
    componentDidMount(){
        const {searchStore}=this.props;
        // console.log(searchStore)
        searchStore.getresultList(this.props.location.state.searchValue);
    }
    check(id,name,e){
        const {seachsongs}=this.props.searchStore
        this.arr={...seachsongs}
        const oldarr= this.arr.songs
        // console.log(oldarr)
        const newarr=oldarr.filter((item,index)=>{
            if(id==item.id){
                let t=document.querySelectorAll("em")
                t[index].className="activelove"
            }
        })
    //    if(newarr){
    //        this.setState({
    //         checked:!this.state.checked
    //        })
    //    }

        // console.log(newarr)
        // this.setState({
        //     // oldarr:[...newarr],
        //     checked:!this.state.checked
        // })
    }
    song2(id){
        console.log(id)
    }
    render(){
        const {seachsongs}=this.props.searchStore
        this.arr={...seachsongs}
        return(
           <div>
                <ul>
                {
                      (this.arr.songs || []).map(({name,id,ar})=>{
                       
                           return (
                               <li key={id} className="li2">
                                   <span className="bigspan">
                                        <span>{ar[0].name}</span>
                                        &nbsp;&nbsp;&nbsp;
                                        --
                                        &nbsp;&nbsp;&nbsp;
                                        <span onClick={this.song2.bind(this,id)}>{name}</span>
                                   </span>
                                  <em className={this.state.checked?'activelove':"love"}   onClick={this.check.bind(this,id,name)} ></em>
                               </li>
                           )
                       })
                   }
                </ul>
           </div>
        )
    }
}
=======
import React from "react"
import { observer,inject } from "mobx-react"
@inject('searchStore')
@observer
class Result extends React.Component{
    constructor(){
        super()
        this.state={
            arr:[],
            checked:false
        }
    }
    componentDidMount(){
        const {searchStore}=this.props;
        // console.log(searchStore)
        searchStore.getresultList(this.props.location.state.searchValue);
    }
    check(id,name,e){
        const {seachsongs}=this.props.searchStore
        this.arr={...seachsongs}
        const oldarr= this.arr.songs
        // console.log(oldarr)
        const newarr=oldarr.filter((item,index)=>{
            if(id==item.id){
                let t=document.querySelectorAll("em")
                t[index].className="activelove"
            }
        })
    //    if(newarr){
    //        this.setState({
    //         checked:!this.state.checked
    //        })
    //    }

        // console.log(newarr)
        // this.setState({
        //     // oldarr:[...newarr],
        //     checked:!this.state.checked
        // })
    }
    song2(id){
        console.log(id)
    }
    render(){
        const {seachsongs}=this.props.searchStore
        this.arr={...seachsongs}
        return(
           <div>
                <ul>
                {
                      (this.arr.songs || []).map(({name,id,ar})=>{
                       
                           return (
                               <li key={id} className="li2">
                                   <span className="bigspan">
                                        <span>{ar[0].name}</span>
                                        &nbsp;&nbsp;&nbsp;
                                        --
                                        &nbsp;&nbsp;&nbsp;
                                        <span onClick={this.song2.bind(this,id)}>{name}</span>
                                   </span>
                                  <em className={this.state.checked?'activelove':"love"}   onClick={this.check.bind(this,id,name)} ></em>
                               </li>
                           )
                       })
                   }
                </ul>
           </div>
        )
    }
}
>>>>>>> 3ef2a7301991405f246e5687924fdd0e40607de4
export default Result